In this script, there is conducted the estimation for the
measure_marginal approach for a single given env.
The env = revm, the programs file =pg_marginal_full5_c50_step5_shuffle.csv, the resutls file = results_revm_marginal_full5_c50_step5.csv.
Switch removed_outliers to FALSE to see the
comparison.
if (!removed_outliers) {
boxplot(measurements[which(measurements$env == env), 'measure_total_time_ns'] ~ measurements[which(measurements$env == env), 'opcode'], las=2, outline=TRUE, log='y', main=paste(env, 'all'))
}
if (removed_outliers) {
measurements = remove_compare_outliers(measurements, 'measure_total_time_ns', c(env))
}
Every sample starts with a fresh evm instance. We investigate whether the results may depend on the time from evm start - related to run_id. To avoid being overrun by the number of images, all op_count for a given run_id are are placed, so values are not centered. That should not be an issue.
Now we can investigate the linear regressions.
for (opcode in all_opcodes) {
estimate = compute_all(opcode=opcode, env=env, use_median=TRUE, plots=ifelse(details,'all','scatter'))
estimates[nrow(estimates) + 1, ] = c(opcode, estimate, env)
}
estimates
## op estimate_marginal_ns estimate_marginal_ns_stderr env
## 1 ADD 1.828181818 0.32775484 revm
## 2 MUL 2.559090909 0.17708356 revm
## 3 SUB 1.943636364 0.15047400 revm
## 4 DIV 5.244545455 0.27079772 revm
## 5 SDIV 8.932727273 0.14281185 revm
## 6 MOD 5.280000000 0.34483411 revm
## 7 SMOD 8.937272727 0.25965984 revm
## 8 ADDMOD 22.610909091 0.14602036 revm
## 9 MULMOD 12.834545455 0.21990815 revm
## 10 EXP 23.733636364 0.37070045 revm
## 11 SIGNEXTEND 8.629090909 0.24009028 revm
## 12 LT 1.965454545 0.25016725 revm
## 13 GT 2.243636364 0.25284715 revm
## 14 SLT 2.566363636 0.45239197 revm
## 15 SGT 2.740909091 0.42250456 revm
## 16 EQ 1.435454545 0.38493187 revm
## 17 ISZERO 1.527272727 0.10639773 revm
## 18 AND 1.524545455 0.27303535 revm
## 19 OR 1.609090909 0.17955664 revm
## 20 XOR 1.665454545 0.22846475 revm
## 21 NOT 1.181818182 0.28210803 revm
## 22 BYTE 2.117272727 0.25665772 revm
## 23 SHL 10.550000000 0.30889403 revm
## 24 SHR 5.337272727 0.41055395 revm
## 25 SAR 9.692727273 0.27362747 revm
## 26 ADDRESS 2.156363636 0.07433575 revm
## 27 ORIGIN 2.355454545 0.07140142 revm
## 28 CALLER 2.079090909 0.07007211 revm
## 29 CALLVALUE 1.857272727 0.14667762 revm
## 30 CALLDATALOAD 2.167272727 0.47423458 revm
## 31 CALLDATASIZE 3.561818182 0.99088203 revm
## 32 CALLDATACOPY 3.906363636 0.58081914 revm
## 33 CODESIZE 3.747272727 0.96495698 revm
## 34 CODECOPY 5.309090909 0.21318349 revm
## 35 GASPRICE 2.050909091 0.14981593 revm
## 36 RETURNDATASIZE 3.669090909 0.99176981 revm
## 37 RETURNDATACOPY -0.620000000 0.43880169 revm
## 38 COINBASE 2.104545455 0.07968890 revm
## 39 TIMESTAMP 1.929090909 0.07118052 revm
## 40 NUMBER 1.950909091 0.06705397 revm
## 41 DIFFICULTY 2.197272727 0.08311597 revm
## 42 GASLIMIT 1.824545455 0.11000083 revm
## 43 CHAINID 3.622727273 0.94877404 revm
## 44 SELFBALANCE 1.875454545 0.10426665 revm
## 45 POP 2.307272727 0.42575013 revm
## 46 MLOAD 1.340909091 0.42388892 revm
## 47 MSTORE 2.213636364 0.40770529 revm
## 48 MSTORE8 1.888181818 0.25545850 revm
## 49 JUMP 2.593636364 0.33934402 revm
## 50 JUMPI 2.284545455 0.27920440 revm
## 51 PC 3.628181818 1.01183896 revm
## 52 MSIZE 3.616363636 1.02723322 revm
## 53 GAS 3.689090909 1.03034385 revm
## 54 JUMPDEST 0.927272727 0.02531709 revm
## 55 PUSH1 2.451818182 0.37520622 revm
## 56 PUSH2 2.521818182 0.17977233 revm
## 57 PUSH3 2.390000000 0.10584350 revm
## 58 PUSH4 2.638181818 0.18544761 revm
## 59 PUSH5 2.628181818 0.15884078 revm
## 60 PUSH6 2.417272727 0.16875251 revm
## 61 PUSH7 2.394545455 0.12815137 revm
## 62 PUSH8 2.482727273 0.18899935 revm
## 63 PUSH9 2.240000000 0.09196558 revm
## 64 PUSH10 2.640000000 0.09419516 revm
## 65 PUSH11 2.421818182 0.20791147 revm
## 66 PUSH12 2.260000000 0.16213792 revm
## 67 PUSH13 2.971818182 0.18327172 revm
## 68 PUSH14 2.657272727 0.16435057 revm
## 69 PUSH15 2.715454545 0.16452927 revm
## 70 PUSH16 2.556363636 0.14821125 revm
## 71 PUSH17 2.410909091 0.18083471 revm
## 72 PUSH18 2.368181818 0.10624875 revm
## 73 PUSH19 2.457272727 0.09744721 revm
## 74 PUSH20 2.275454545 0.08828069 revm
## 75 PUSH21 2.358181818 0.10942038 revm
## 76 PUSH22 2.426363636 0.19865919 revm
## 77 PUSH23 2.308181818 0.09608450 revm
## 78 PUSH24 2.309090909 0.11091075 revm
## 79 PUSH25 2.339090909 0.14903146 revm
## 80 PUSH26 2.905454545 0.14688189 revm
## 81 PUSH27 2.455454545 0.19583801 revm
## 82 PUSH28 2.535454545 0.11295310 revm
## 83 PUSH29 2.345454545 0.18751186 revm
## 84 PUSH30 2.452727273 0.16052485 revm
## 85 PUSH31 2.454545455 0.17860802 revm
## 86 PUSH32 2.582727273 0.20960828 revm
## 87 DUP1 1.488181818 0.33471491 revm
## 88 DUP2 2.047272727 0.23037001 revm
## 89 DUP3 1.719090909 0.10321685 revm
## 90 DUP4 1.512727273 0.30059079 revm
## 91 DUP5 1.594545455 0.31336967 revm
## 92 DUP6 1.524545455 0.17869823 revm
## 93 DUP7 1.535454545 0.37474191 revm
## 94 DUP8 1.825454545 0.25842214 revm
## 95 DUP9 1.770909091 0.32593667 revm
## 96 DUP10 1.840909091 0.33463588 revm
## 97 DUP11 1.806363636 0.31647899 revm
## 98 DUP12 1.639090909 0.30497723 revm
## 99 DUP13 1.596363636 0.33841634 revm
## 100 DUP14 1.810909091 0.34144080 revm
## 101 DUP15 1.726363636 0.33118855 revm
## 102 DUP16 1.924545455 0.25527511 revm
## 103 SWAP1 2.512727273 0.44508375 revm
## 104 SWAP2 2.560000000 0.48670138 revm
## 105 SWAP3 2.521818182 0.43283548 revm
## 106 SWAP4 2.557272727 0.42269751 revm
## 107 SWAP5 2.580000000 0.43414376 revm
## 108 SWAP6 2.416363636 0.51959191 revm
## 109 SWAP7 2.509090909 0.42933737 revm
## 110 SWAP8 2.644545455 0.37236482 revm
## 111 SWAP9 2.540000000 0.41222414 revm
## 112 SWAP10 2.368181818 0.37762427 revm
## 113 SWAP11 2.566363636 0.38408072 revm
## 114 SWAP12 2.550000000 0.47525306 revm
## 115 SWAP13 2.610000000 0.42612774 revm
## 116 SWAP14 2.568181818 0.43732165 revm
## 117 SWAP15 2.391818182 0.35245421 revm
## 118 SWAP16 2.344545455 0.38065708 revm
## 119 MCOPY 3.794545455 0.52882947 revm
## 120 PUSH0 1.778181818 0.11787996 revm
## 121 SHA3 485.856363636 0.55236664 revm
## 122 LOG0 31.594545455 0.60980540 revm
## 123 LOG1 49.384545455 0.80062825 revm
## 124 LOG2 47.112727273 1.54907075 revm
## 125 LOG3 40.730000000 3.22883631 revm
## 126 LOG4 33.537272727 4.16754083 revm
## 127 EXTCODEHASH 0.132727273 0.07500474 revm
## 128 EXTCODESIZE 0.142727273 0.08377623 revm
## 129 EXTCODECOPY -0.055454545 0.05457827 revm
## 130 CREATE 4.400909091 0.23721273 revm
## 131 CALL 0.011818182 0.02544553 revm
## 132 STATICCALL 0.001818182 0.04353102 revm
## 133 DELEGATECALL 0.013636364 0.03517632 revm
## 134 RETURN -0.013636364 0.02630436 revm
## 135 REVERT -0.006363636 0.01909572 revm
## 136 STOP 0.036363636 0.02086293 revm
The results are exported to ./revm_marginal_estimated_cost.csv.